package util;

import entity.Poem;

import java.util.List;

public class JueJuFilter {
    /**
     * 去掉poemList中的非五言绝句
     * 注意：这个方法会改变传入的list，如果不想改变，请传入前做深拷贝
     * @param poemList
     * @return
     */
    public List<Poem> doFilter(List<Poem> poemList){
        for (int i=0;i<poemList.size();i++){
            Poem  poem = poemList.get(i);

            if (poem.getParagraphs().size()==0||poem.getParagraphs().size()>2||poem.getParagraphs().get(0).length()!=12){
                poemList.remove(i);
                i--;
            }
        }
        return poemList;
    }
}
